﻿using System;
using System.Windows.Forms;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using YArchitech.Revit.Electric.Common;
using YArchitech.Revit.MEP.Calculator;

namespace YArchitech.Revit.MEP.Electric.Calculator.Command
{
	[Regeneration(RegenerationOption.Manual)]
	[Transaction(TransactionMode.Manual)]
	public class CmdCaculateCheck : IExternalCommand
	{
		public Result Execute(ExternalCommandData cmdData, ref string message, ElementSet elements)
		{
			if (cmdData.Application.ActiveUIDocument.Document.ActiveView is ViewPlan)
			{
				RequestHandler requestHandler = new RequestHandler();
				new CaculateCount(ExternalEvent.Create(requestHandler), requestHandler, cmdData.Application).Show(WindowHelper.HWndRevit);
				return Autodesk.Revit.UI.Result.Succeeded;
			}
			MessageBox.Show("照度校核功能无法在此视图中执行，请切换到平面视图下运行!", "盈建科提示");
			return Autodesk.Revit.UI.Result.Cancelled;
		}

		public delegate void MethedOperaton(UIApplication ui_app);
	}
}
